package com.gitee.wsl.platform.func.executor.sample

import android.os.Looper
import com.gitee.wsl.concurrent.executor.Executor

/** A [LooperExecutor] that executes runnables on Android's main thread.  */
class MainThreadExecutor private constructor() : LooperExecutor(Looper.getMainLooper()) {
     companion object {
        /** Creates a [com.gitee.wsl.platform.concurrent.runner.WorkRunner] that runs work on Android's main thread.  */
        @JvmStatic
        fun create(): MainThreadExecutor {
            return MainThreadExecutor()
        }
    }
}

fun Executor.Companion.mainThread(): Executor = MainThreadExecutor.create()